package com.weixing.mall.provider.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoNeedAccess;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.api.model.enums.OrderTypeEnum;
import com.weixing.mall.provider.model.vo.report.finance.*;
import com.weixing.mall.provider.model.vo.report.finance.newest.regular.*;
import com.weixing.mall.provider.model.vo.report.finance.newest.seckill.FinanceSeckillSummary1Vo;
import com.weixing.mall.provider.model.vo.report.finance.newest.seckill.FinanceSeckillSummary2Vo;
import com.weixing.mall.provider.model.vo.report.finance.newest.seckill.FinanceSeckillSummaryDetail1Vo;
import com.weixing.mall.provider.model.vo.report.finance.newest.seckill.FinanceSeckillSummaryRebateDetailVo;
import com.weixing.mall.provider.service.IDayReportFinanceService;
import com.weixing.mall.provider.util.EasyExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @author jzy
 * @date 2020/5/31
 */
@RestController
@RequestMapping("report")
@Api(value = "后台报表APi", tags = "后台报表-财务部报表")
public class ReportFinanceController extends BaseController {
    @Autowired
    private IDayReportFinanceService financeService;


    @ApiOperation(value = "1财务部报表-最新表样-正价财务报表-表样1-正价汇总表1")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/regular/summary1")
    public Result<IPage<FinanceRegularSummary1Vo>> regularSummary1(String yearMonth, String startTime, String endTime){
        IPage<FinanceRegularSummary1Vo> page = financeService.regularSummary1(OrderTypeEnum.NORMAL.getValue(),yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部报表-最新表样-正价财务报表-表样2-正价汇总表2")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/regular/summary2")
    public Result<IPage<FinanceRegularSummary2Vo>> regularSummary2(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummary2Vo> page = financeService.regularSummary2(roleType, agentId,OrderTypeEnum.NORMAL.getValue(), yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-正价明细表-表样3-表样3-1订单明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/regular/summary/detail1")
    public Result<IPage<FinanceRegularSummaryDetail1Vo>> regularSummaryDetail1(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryDetail1Vo> page = financeService.regularSummaryDetail1(roleType, agentId, OrderTypeEnum.NORMAL.getValue(), null, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-正价明细表-表样3-表样3-2退货明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/regular/summary/detail2")
    public Result<IPage<FinanceRegularSummaryDetail1Vo>> regularSummaryDetail2(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryDetail1Vo> page = financeService.regularSummaryDetail1(roleType, agentId, OrderTypeEnum.NORMAL.getValue(), 1, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-正价明细表-表样3-表样3-3断货/取消明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/regular/summary/detail3")
    public Result<IPage<FinanceRegularSummaryDetail1Vo>> regularSummaryDetail3(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryDetail1Vo> page = financeService.regularSummaryDetail1(roleType, agentId, OrderTypeEnum.NORMAL.getValue(), 2, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-正价明细表-表样3-表样3-4返代理款明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/regular/summary/detail4")
    public Result<IPage<FinanceRegularSummaryDetail4Vo>> regularSummaryDetail4(Integer roleType, Long agentId, String yearMonth, String startTime, String endTime){
        IPage<FinanceRegularSummaryDetail4Vo> page = financeService.regularSummaryDetail4(roleType, agentId, OrderTypeEnum.NORMAL.getValue(), null, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-正价明细表-表样3-表样3-4-1返代理款明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/regular/summary/rebate/detail")
    public Result<IPage<FinanceRegularSummaryRebateDetailVo>> regularSummaryRebateDetailVo(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryRebateDetailVo> page = financeService.regularSummaryRebateDetailVo(roleType, agentId, OrderTypeEnum.NORMAL.getValue(), yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部报表-最新表样-4折财务报表 -表样1-4折汇总表1")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/summary1")
    public Result<IPage<FinanceRegularSummary1Vo>> agentSummary1(String yearMonth, String startTime, String endTime){
        IPage<FinanceRegularSummary1Vo> page = financeService.regularSummary1(OrderTypeEnum.AGENT.getValue(),yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部报表-最新表样-4折财务报表-表样2-4折汇总表2")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/summary2")
    public Result<IPage<FinanceRegularSummary2Vo>> agentSummary2(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummary2Vo> page = financeService.regularSummary2(roleType, agentId,OrderTypeEnum.AGENT.getValue(), yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-4折财务报表-表样3-表样3-1订单明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/summary/detail1")
    public Result<IPage<FinanceRegularSummaryDetail1Vo>> agentSummaryDetail1(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryDetail1Vo> page = financeService.regularSummaryDetail1(roleType, agentId, OrderTypeEnum.AGENT.getValue(), null, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-4折财务报表-表样3-表样3-2退货明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/summary/detail2")
    public Result<IPage<FinanceRegularSummaryDetail1Vo>> agentSummaryDetail2(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryDetail1Vo> page = financeService.regularSummaryDetail1(roleType, agentId, OrderTypeEnum.AGENT.getValue(), 1, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-4折财务报表-表样3-表样3-3断货/取消明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/summary/detail3")
    public Result<IPage<FinanceRegularSummaryDetail1Vo>> agentSummaryDetail3(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryDetail1Vo> page = financeService.regularSummaryDetail1(roleType, agentId, OrderTypeEnum.AGENT.getValue(), 2, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-4折财务报表-表样3-表样3-4返代理款明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/summary/detail4")
    public Result<IPage<FinanceRegularSummaryDetail4Vo>> agentSummaryDetail4(Integer roleType, Long agentId, String yearMonth, String startTime, String endTime){
        IPage<FinanceRegularSummaryDetail4Vo> page = financeService.regularSummaryDetail4(roleType, agentId, OrderTypeEnum.AGENT.getValue(), null, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-4折财务报表-表样3-表样3-4-1返代理款明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/summary/rebate/detail")
    public Result<IPage<FinanceRegularSummaryRebateDetailVo>> agentSummaryRebateDetailVo(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceRegularSummaryRebateDetailVo> page = financeService.regularSummaryRebateDetailVo(roleType, agentId, OrderTypeEnum.AGENT.getValue(), yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部报表-最新表样-2.5折财务报表-表样1-2.5折汇总表1")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/seckill/summary1")
    public Result<IPage<FinanceSeckillSummary1Vo>> seckillSummary1(String yearMonth, String startTime, String endTime){
        IPage<FinanceSeckillSummary1Vo> page = financeService.seckillSummary1(yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部报表-最新表样-2.5折财务报表-表样2- 2.5折汇总表2")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/seckill/summary2")
    public Result<IPage<FinanceSeckillSummary2Vo>> seckillSummary2(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceSeckillSummary2Vo> page = financeService.seckillSummary2(roleType, agentId, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-2.5折财务报表-表样3-表样3-1订单明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/seckill/summary/detail1")
    public Result<IPage<FinanceSeckillSummaryDetail1Vo>> seckillSummaryDetail1(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceSeckillSummaryDetail1Vo> page = financeService.seckillSummaryDetail1(roleType, agentId, null, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-2.5折财务报表-表样3-表样3-2退货明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/seckill/summary/detail2")
    public Result<IPage<FinanceSeckillSummaryDetail1Vo>> seckillSummaryDetail2(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceSeckillSummaryDetail1Vo> page = financeService.seckillSummaryDetail1(roleType, agentId, 1, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-2.5折财务报表-表样3-表样3-3断货/取消明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/seckill/summary/detail3")
    public Result<IPage<FinanceSeckillSummaryDetail1Vo>> seckillSummaryDetail3(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceSeckillSummaryDetail1Vo> page = financeService.seckillSummaryDetail1(roleType, agentId, 2, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-2.5折财务报表-表样3-表样3-4返代理款明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/seckill/summary/detail4")
    public Result<IPage<FinanceSeckillSummaryDetail1Vo>> seckillSummaryDetail4(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceSeckillSummaryDetail1Vo> page = financeService.seckillSummaryDetail1(roleType, agentId, 3, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "1财务部-最新表样-2.5折财务报表-表样3-表样3-4-1返代理款明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "客服或者代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/seckill/summary/rebate/detail")
    public Result<IPage<FinanceSeckillSummaryRebateDetailVo>> seckilSummaryRebateDetailVo(Integer roleType,Long agentId,String yearMonth,String startTime,String endTime){
        IPage<FinanceSeckillSummaryRebateDetailVo> page = financeService.seckilSummaryRebateDetail(roleType, agentId, yearMonth, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }

    @ApiOperation(value = "2财务部报表--代理晋升报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "customerId", value = "客服Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "distributorId", value = "经销商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentName", value = "代理商名称",required = false, paramType = "query")
    })
    @GetMapping("/finance/promote")
    public Result<IPage<FinancePromoteVo>> financePromote(Long customerId, Long distributorId, String startTime, String endTime, String agentName){
        IPage<FinancePromoteVo> page = financeService.financePromote(customerId, distributorId, startTime, endTime, agentName, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "2财务部报表--代理晋升报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "customerId", value = "客服Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "distributorId", value = "经销商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentName", value = "代理商名称",required = false, paramType = "query")
    })
    @GetMapping("/finance/promote/excel")
    @NoNeedAccess
    public void financePromoteExcel(Long customerId, Long distributorId, String startTime, String endTime, String agentName, HttpServletResponse response){
        IPage<FinancePromoteVo> page = financeService.financePromote(customerId, distributorId, startTime, endTime, agentName, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,FinancePromoteVo.class,page.getRecords(),"代理商晋升报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "2财务部报表--代理晋升报表-晋升明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/promote/detail")
    public Result<IPage<FinancePromoteDetailVo>> financePromoteDetail(Long agentId, String startTime, String endTime){
        IPage<FinancePromoteDetailVo> page = financeService.financePromoteDetail(agentId, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "2财务部报表--代理晋升报表-晋升明细-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/promote/detail/excel")
    @NoNeedAccess
    public void financePromoteDetailExcel(Long agentId, String startTime, String endTime,HttpServletResponse response){
        IPage<FinancePromoteDetailVo> page = financeService.financePromoteDetail(agentId, startTime, endTime, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,FinancePromoteDetailVo.class,page.getRecords(),"晋升明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "3财务部报表--代理收费报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/fee")
    public Result<IPage<FinanceAgentFeeVo>> financeAgentFee(Integer roleType,Long agentId, String startTime, String endTime){
        IPage<FinanceAgentFeeVo> page = financeService.financeAgentFee(roleType, agentId, startTime, endTime, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "3财务部报表--代理收费报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/fee/excel")
    @NoNeedAccess
    public void financeAgentFeeExcel(Integer roleType,Long agentId, String startTime, String endTime,HttpServletResponse response){
        IPage<FinanceAgentFeeVo> page = financeService.financeAgentFee(roleType, agentId, startTime, endTime, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,FinanceAgentFeeVo.class,page.getRecords(),"代理收费报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "3财务部报表--代理收费报表-详细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 1试用用户总数 2试用过期总数 3转正收款总数 4正式总数 5退款用户总数 6过期用户总数",required = false, paramType = "query"),
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentName", value = "代理商名称",required = false, paramType = "query"),
            @ApiImplicitParam(name = "mobile", value = "手机号",required = false, paramType = "query"),
            @ApiImplicitParam(name = "cardId", value = "身份证号",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/fee/detail")
    public Result<IPage<FinanceAgentFeeDetailVo>> financeAgentFeeDetail(Integer type, Integer roleType, Long agentId, String startTime, String endTime,
                                                                        String agentName,String mobile,String cardId){
        IPage<FinanceAgentFeeDetailVo> page = financeService.financeAgentFeeDetail(type, roleType, agentId, startTime, endTime, agentName, mobile, cardId, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "3财务部报表--代理收费报表-详细-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 1试用用户总数 2试用过期总数 3转正收款总数 4正式总数 5退款用户总数 6过期用户总数",required = false, paramType = "query"),
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentName", value = "代理商名称",required = false, paramType = "query"),
            @ApiImplicitParam(name = "mobile", value = "手机号",required = false, paramType = "query"),
            @ApiImplicitParam(name = "cardId", value = "身份证号",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query")
    })
    @GetMapping("/finance/agent/fee/detail/excel")
    @NoNeedAccess
    public void financeAgentFeeDetailExcel(Integer type, Integer roleType, Long agentId, String startTime, String endTime,
                                           String agentName,String mobile,String cardId,HttpServletResponse response){
        IPage<FinanceAgentFeeDetailVo> page = financeService.financeAgentFeeDetail(type, roleType, agentId, startTime, endTime,agentName, mobile, cardId, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,FinanceAgentFeeDetailVo.class,page.getRecords(),"代理收费明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "4财务部报表--客服业绩报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价 2代理商活动 3秒杀活动",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actName", value = "活动名称",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/finance/customer/performance")
    public Result<IPage<FinanceCustomerPerformanceVo>> financeCustomerPerformance(Integer orderType,String actName, String startTime, String endTime,String sortField,String sortType){
        IPage<FinanceCustomerPerformanceVo> page = financeService.financeCustomerPerformance(orderType,actName, startTime, endTime, sortField, sortType, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "4财务部报表--客服业绩报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价 2代理商活动 3秒杀活动",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actName", value = "活动名称",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/finance/customer/performance/excel")
    @NoNeedAccess
    public void financeCustomerPerformanceExcel(Integer orderType,String actName, String startTime, String endTime,String sortField,String sortType,HttpServletResponse response){
        IPage<FinanceCustomerPerformanceVo> page = financeService.financeCustomerPerformance(orderType, actName,startTime, endTime, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,FinanceCustomerPerformanceVo.class,page.getRecords(),"客服业绩报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "4财务部报表--客服业绩报表--详细业绩")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderType", value = "订单类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actName", value = "活动名称",required = false, paramType = "query"),
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/finance/customer/performance/detail")
    public Result<IPage<FinanceCustomerPerformanceDetailVo>> financeCustomerPerformanceDetail(Integer orderType,String actName,Integer roleType,Long agentId,Long agentPid,Integer pRole,String userName,String startTime, String endTime,String sortField,String sortType){
        IPage<FinanceCustomerPerformanceDetailVo> page = financeService.financeCustomerPerformanceDetail(orderType, actName,roleType, agentId,agentPid,pRole, userName, startTime, endTime, sortField, sortType, initMpPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "4财务部报表--客服业绩报表--详细业绩-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderType", value = "订单类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actName", value = "活动名称",required = false, paramType = "query"),
            @ApiImplicitParam(name = "roleType", value = "角色类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "agentId", value = "代理商Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/finance/customer/performance/detail/excel")
    @NoNeedAccess
    public void financeCustomerPerformanceDetailExcel(Integer orderType,String actName, Integer roleType,Long agentId,Long agentPid,Integer pRole,String userName,String startTime, String endTime,String sortField,String sortType,HttpServletResponse response){
        IPage<FinanceCustomerPerformanceDetailVo> page = financeService.financeCustomerPerformanceDetail(orderType, actName,roleType, agentId,agentPid,pRole, userName, startTime, endTime, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,FinanceCustomerPerformanceDetailVo.class,page.getRecords(),"客服业绩明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
